import request from '@/utils/request';

/**
 * plan查询接口
 */
export async function planViewSearch(data: API.PlanSearchInfo, options?: API.baseOption) {
  return request<any>('/cardbagplan/plan-view-search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * activity查询查询接口
 */
export async function activityViewSearch(data: API.PlanSearchInfo, options?: API.baseOption) {
  return request<any>('/cardbagplan/activity-view-search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动效果视图明细
 */
export async function activityDetail(
  data: {
    date?: string;
    channelId?: string;
    onlyOpenPlace?: boolean;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/activity-detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动---导出
 */
export async function activityExportLate(data: any, options?: API.baseOption) {
  return request<any>('/cardbagplan/activity-detail-export', {
    responseType: 'blob',
    getResponse: true,
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动大盘TC
 */
export async function activityBigTc(
  data: {
    date?: string;
    channelId?: string;
    onlyOpenPlace?: boolean;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/activity-bigTc', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 运营计划明细
 */
export async function planDetail(
  data: {
    id?: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/plan-detail', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 运营计划编辑校验
 */
export async function planEditValid(
  data: {
    id?: string;
    activityIds?: string;
    startTime?: string;
    endTime?: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/plan-edit-valid', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 运营计划编辑
 */
export async function planEdit(data: API.PlanEditInfo, options?: API.baseOption) {
  return request<any>('/cardbagplan/plan-edit', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 运营计划状态修改
 */
export async function planEditStatus(
  data: {
    id?: string;
    status?: number;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/plan-edit-status', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 运营计划状态删除
 */
export async function planDelete(
  data: {
    id?: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/delete', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动列表
 */
export async function activitySearch(data: API.ActivitySearchInfo, options?: API.baseOption) {
  return request<any>('/cardbagplan/activity-search', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动列表 BY campaigncode
 */
export async function activitySearchByCampaigncode(
  data: API.ActivitySearchInfo,
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/activity-search-by-campaigncode', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动效果
 */
export async function activityEffect(
  data: {
    activityId?: string;
    campaignCode?: string;
    channel?: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/activity-effect', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 活动效果添加
 */
export async function activityEffectAdd(
  data: {
    campaignCode?: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/activity-effect-add', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * campaigncode补全
 */
export async function campaigncodeList(
  data: {
    campaignCode?: string;
    brandName?: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/cardbagplan/campaigncode-list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 缓存清理  --14个接口
 */
export async function resetCache(data: {}, options?: API.baseOption) {
  return request<any>('/cardbagplan/reset-cache', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * profile列表
 */
export async function getProfileList(
  data: {
    activityId?: string;
    profileStatus: string;
  },
  options?: API.baseOption,
) {
  return request<any>('/options/profile-list', {
    method: 'POST',
    data,
    ...(options || {}),
  });
}

/**
 * 2.22.16 活动效果视图明细导出V2 /coupon-config/cardbagplan/activity-detail-export-v2
 */
export async function activityDetailExportV2(data: any, options?: API.baseOption) {
  return request<any>('/cardbagplan/activity-detail-export-v2', {
    responseType: 'blob',
    getResponse: true,
    method: 'POST',
    data,
    ...(options || {}),
  });
}
